package com.atguigu.javase.thread;

//synchronized 对象最好全局唯一 ""
public class Counter implements Runnable{

    private int counter = 200;
    @Override
    public void run() {
//        synchronized (this) {

        for (int i = 0; i < 50; i++) {
            synchronized ("  ") {

            counter -= 2;
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName() +":" +counter);
            }
        }
//        }
    }
}
